package com.taoym.voucher.xcx.controller;

import com.taoym.voucher.common.response.Response;
import com.taoym.voucher.xcx.entity.dto.XcxGetMtYouXuanDTO;
import com.taoym.voucher.xcx.entity.vo.XcxGetMtYouXuanResp;
import com.taoym.voucher.xcx.entity.vo.XcxGetPromotionVO;
import com.taoym.voucher.xcx.service.XcxPromotionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @coder taoym
 * @datetime 2021/6/7 10:18
 * @desc 活动推广控制器
 */
@Api(tags = "活动推广控制器")
@RestController
@RequestMapping("/promotion")
@Validated
public class XcxPromotionController {

    @Autowired
    private XcxPromotionService xcxPromotionService;

    @ApiOperation("查询活动推广信息")
    @GetMapping("/get")
    public Response<XcxGetPromotionVO> getPromotion(@RequestParam @NotNull(message = "平台信息不能为空") Integer platform,
                                                    @RequestParam @NotNull(message = "活动编号不能为空") Integer actId) {
        return Response.success(xcxPromotionService.getPromotion(platform, actId));
    }

    @ApiOperation("美团优选")
    @GetMapping("youXuan")
    public Response<List<XcxGetMtYouXuanResp>> mtYouXuan(@Valid XcxGetMtYouXuanDTO data) {
        return Response.success(xcxPromotionService.mtYouXuan(data));
    }
}
